package com.demo.test.controller;

import com.demo.test.entity.User;
import com.demo.test.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author XieHuan
 * @since 2017-06-10
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private IUserService iUserService;

    @RequestMapping("/all")
    @ResponseBody
    public User all() {
        return iUserService.selectById("1");
    }

    @RequestMapping("/all1")
    @ResponseBody
    public List<User> AllU(){
        return iUserService.selectList(null);
    }
    @RequestMapping("/login.html")
    public String loginyejian(){

        return "login";
    }
    @RequestMapping("/index.html")
    public String shouye(){

        return "_admin/index";
    }

    @RequestMapping("/sing.html")
    public String sing(){

        return "_admin/sing";
    }
    @RequestMapping("/battle.html")
    public  String battle(){
        return  "_admin/battle";
    }
    @RequestMapping("/tongji.html")
    public String tongji(){
        return  "_admin/tongji";
    }
    @RequestMapping("/demo")
    public String demo(){
        return "demo";
    }



    @RequestMapping("/login")
    @ResponseBody
    public  User login(User user ){
        User i=iUserService.selectById(user);
        return i;
    }
	
}
